package com.hotline.communication.service.impl;

import com.hotline.communication.mapper.SatisfactionMapper;
import com.hotline.communication.dto.SatisfactionDTO;
import com.hotline.communication.manager.SatisfactionManager;
import com.hotline.communication.service.SatisfactionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@Slf4j
public class SatisfactionServiceImpl implements SatisfactionService {

    @Resource
    private SatisfactionMapper satisfactionMapper;

    @Autowired
    private SatisfactionManager satisfactionManager;

    @Override
    public void insert(SatisfactionDTO satisfactionDTO) {
        try {
            log.info("TX_LOG[]satisfaction[]满意度[]新增满意度[]satisfactionDTO:{}",satisfactionDTO);
            satisfactionManager.insert(satisfactionDTO);
        }catch (Exception e){
            log.error("新增新增满意度失败, satisfactionDTO={}, cause:{}", satisfactionDTO,e.getMessage());
        }
    }

    @Override
    public void update(SatisfactionDTO satisfactionDTO) {
        try {
            log.info("TX_LOG[]satisfaction[]满意度[]更新满意度[]satisfactionDTO:{}",satisfactionDTO);
            satisfactionMapper.update(satisfactionDTO);
        }catch (Exception e){
            log.error("更新新增满意度失败, satisfactionDTO={}, cause:{}", satisfactionDTO,e.getMessage());
        }
    }


    @Override
    public SatisfactionDTO selectById(String callId) {
        SatisfactionDTO satisfactionDTO = satisfactionMapper.selectById(callId);
        return satisfactionDTO;
    }
}
